Unit GercekStokListesi;

Interface
                                 
Uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MainGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, ADODB, StdCtrls, Buttons, ExtCtrls,
  cxGridLevel, cxClasses, cxControls, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
  cxDBLookupComboBox, Menus, cxImageComboBox, ppBands, ppCache, ppClass,
  ppProd, ppReport, ppDB, ppComm, ppRelatv, ppDBPipe, cxCheckBox;

Type
  TGercekStokListesiF = Class(TMainGridF)
    cxGrid1DBTableView1stokkodu: TcxGridDBColumn;
    cxGrid1DBTableView1cinsi: TcxGridDBColumn;
    PopupMenu1: TPopupMenu;
    AmbarToplamlar1: TMenuItem;
    MalzemeHarektleri1: TMenuItem;
    SipariHareketleri1: TMenuItem;
    bstokexstre: TBitBtn;
    bambartoplamlari: TButton;
    bmalzemehareketleri: TButton;
    bsiparishareketleri: TButton;
    N1: TMenuItem;
    StokBul1: TMenuItem;
    cxGrid1DBTableView1UstGrupId: TcxGridDBColumn;
    cxGrid1DBTableView1GrupId: TcxGridDBColumn;
    cxGrid1DBTableView1MarkaId: TcxGridDBColumn;
    cxGrid1DBTableView1ModelId: TcxGridDBColumn;
    cxGrid1DBTableView1AltGrupId: TcxGridDBColumn;
    cxGrid1DBTableView1UreticiKodu: TcxGridDBColumn;
    cxGrid1DBTableView1UreticiSatisKodu: TcxGridDBColumn;
    cxGrid1DBTableView1stokkod: TcxGridDBColumn;
    cxGrid1DBTableView1OZKOD1: TcxGridDBColumn;
    cxGrid1DBTableView1OZKOD2: TcxGridDBColumn;
    cxGrid1DBTableView1garuretim: TcxGridDBColumn;
    cxGrid1DBTableView1GARalinan: TcxGridDBColumn;
    cxGrid1DBTableView1garverilen: TcxGridDBColumn;
    cxGrid1DBTableView1garantivar: TcxGridDBColumn;
    cxGrid1DBTableView1ambar: TcxGridDBColumn;
    cxGrid1DBTableView1unitystokkod: TcxGridDBColumn;
    cxGrid1DBTableView1izlemeturu: TcxGridDBColumn;
    cxGrid1DBTableView1barkod: TcxGridDBColumn;
    cxGrid1DBTableView1mamultipi: TcxGridDBColumn;
    cxGrid1DBTableView1desi: TcxGridDBColumn;
    cxGrid1DBTableView1GrupKodu: TcxGridDBColumn;
    cxGrid1DBTableView1SayimGrubu: TcxGridDBColumn;
    cxGrid1DBTableView1Sarf: TcxGridDBColumn;
    cxGrid1DBTableView1Kapasite: TcxGridDBColumn;
    cxGrid1DBTableView1UretimSinirsiz: TcxGridDBColumn;
    cxGrid1DBTableView1KdvOran: TcxGridDBColumn;
    cxGrid1DBTableView1AnaStokkod: TcxGridDBColumn;
    cxGrid1DBTableView1isletimsistemi: TcxGridDBColumn;
    cxGrid1DBTableView1UreticiMarkaId: TcxGridDBColumn;
    cxGrid1DBTableView1EkranAltGrupId: TcxGridDBColumn;
    cxGrid1DBTableView1UnityCardType: TcxGridDBColumn;
    cxGrid1DBTableView1CariGrup: TcxGridDBColumn;
    cxGrid1DBTableView1Birim: TcxGridDBColumn;
    cxGrid1DBTableView1FreePart: TcxGridDBColumn;
    cxGrid1DBTableView1DOA: TcxGridDBColumn;
    cxGrid1DBTableView1CreateDate: TcxGridDBColumn;
    cxGrid1DBTableView1RmaAy: TcxGridDBColumn;
    Procedure FormShow(Sender: TObject);
    Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
    Procedure AmbarToplamlar1Click(Sender: TObject);
    Procedure MalzemeHarektleri1Click(Sender: TObject);
    Procedure SipariHareketleri1Click(Sender: TObject);
    Procedure bambartoplamlariClick(Sender: TObject);
    Procedure bmalzemehareketleriClick(Sender: TObject);
    Procedure bsiparishareketleriClick(Sender: TObject);
    Procedure bstokexstreClick(Sender: TObject);
    Procedure bexportClick(Sender: TObject);
    Procedure StokBul1Click(Sender: TObject);
  Private
    { Private declarations }
  Public
    { Public declarations }
  End;

Var
  GercekStokListesiF: TGercekStokListesiF;

Implementation

Uses data, AmbarToplamlari, MalzemeHareketleri, SiparisHareketleri,
  stokekstre, ana1;

{$R *.dfm}

Procedure TGercekStokListesiF.FormShow(Sender: TObject);
Begin
  Inherited;

  ListeQ.Close;
  ListeQ.Open;

  cxGrid1.SetFocus;
End;

Procedure TGercekStokListesiF.FormClose(Sender: TObject;
  Var Action: TCloseAction);
Begin
  Action := CaFree;
  GercekStokListesiF := Nil;
End;

Procedure TGercekStokListesiF.AmbarToplamlar1Click(Sender: TObject);
Begin
  If ListeQ.RecNo > 0 Then
  Begin
    AmbarToplamlariF := tAmbarToplamlariF.Create(Anaform);
    AmbarToplamlariF.StokKod := ListeQ.fieldbyname('stokkod').asinteger;
    AmbarToplamlariF.FormStyle := FsMdiChild;
  End;
End;

Procedure TGercekStokListesiF.MalzemeHarektleri1Click(Sender: TObject);
Begin
  If ListeQ.RecNo > 0 Then
  Begin
    dm.islemid := ListeQ.fieldbyname('stokkod').value;
    MalzemeHareketleriF := tMalzemeHareketleriF.create(Anaform);
    MalzemeHareketleriF.FormStyle := FsMdiChild;
  End;

End;

Procedure TGercekStokListesiF.SipariHareketleri1Click(Sender: TObject);
Begin
  If ListeQ.RecNo > 0 Then
  Begin
    dm.islemid := ListeQ.fieldbyname('stokkod').value;
    SiparisHareketleriF := tSiparisHareketleriF.create(Anaform);
    SiparisHareketleriF.FormStyle := FsMdiChild;
  End;

End;

Procedure TGercekStokListesiF.bambartoplamlariClick(Sender: TObject);
Begin
  AmbarToplamlar1Click(Sender);
End;

Procedure TGercekStokListesiF.bmalzemehareketleriClick(Sender: TObject);
Begin
  MalzemeHarektleri1Click(Sender);
End;

Procedure TGercekStokListesiF.bsiparishareketleriClick(Sender: TObject);
Begin
  SipariHareketleri1Click(Sender);
End;

Procedure TGercekStokListesiF.bstokexstreClick(Sender: TObject);
Begin
  StokekstreF := tStokekstreF.create(Anaform);
  StokekstreF.FormStyle := fsMDIChild;
End;

Procedure TGercekStokListesiF.bexportClick(Sender: TObject);
Begin
  ExportAl(Self, 'Stok Listesi',ListeQ);
End;

Procedure TGercekStokListesiF.StokBul1Click(Sender: TObject);
Var
  InputString: String;
Begin
  InputString := InputBox('Stok Kodu', 'Giriniz :', '');
  ListeQ.Locate('stokkodu', InputString, [loPartialKey]);

End;

End.
